package com.xnyzc.lhy.common.penum.invoice;

import com.xnyzc.lhy.common.entity.PEnum;

/**
 * 发票操作错误码枚举
 *
 * @Author: haoyfa
 * @Date: 2019/10/25
 */
public enum EInvoiceErrorCode implements PEnum<Integer> {
    //成功
    success(0, "success"),
    //参数及数据错误
    serverError(10100, "服务器错误"),
    clientError(30100, "客户端错误"),
    initializtionError(40100, "参数初始化错误"),
    convertParamError(40101, "参数转化错误"),
    loginError(40200, "登录错误"),
    executeError(40200, "执行任务出错"),
    initInvoiceError(50100, "初始化发票信息错误"),
    farmatFileError(50200, "板式文件生成错误"),
    invoiceIdError(50300, "DIDI发票处理失败"),
    existError(50400, "发票已经存在"),
    notExistError(50500, "发票不存在"),
    unKnow(403, "未知错误"),
    //调用服务失败
    outerServiceError(10100, "调用外部系统对接开票服务失败"),
    bizServiceError(20100, "调用业务开票服务失败"),
    orderAmountError(20200, "发票对应的订单id错误"),
    amountError(20300, "开票金额与订单金额不一致");

    int value;
    String desc;

    EInvoiceErrorCode(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String toString() {
        return name();
    }

    @Override
    public String toChString() {
        return desc;
    }

    public String toMessage() {
        String errorMessage = this.value + "," + this.desc;
        return errorMessage;
    }
}
